package com.casic.ops.entity.vo;

import com.casic.ops.consts.app.ActionType;
import com.casic.ops.entity.domain.ApplicationActionDO;
import com.orion.utils.convert.TypeStore;
import lombok.Data;

/**
 * app操作
 *
 * @author Jiahang Li
 * @version 1.0.0
 * @since 2021/7/8 18:23
 */

/**
 * @ClassName ops-platform
 * @Description app 操作
 * @Author mianbin
 * @Date 2022/5/31 10:59
 * @Version 1.0
 **/
@Data
public class ApplicationActionVO {

    /**
     * id
     */
    private Long id;

    /**
     * 名称
     */
    private String name;

    /**
     * 类型
     *
     * @see ActionType
     */
    private Integer type;

    /**
     * 命令
     */
    private String command;

    public static ApplicationActionVO actionDO2ActionVO(ApplicationActionDO p) {
        ApplicationActionVO vo = new ApplicationActionVO();
        vo.setId(p.getId());
        vo.setName(p.getActionName());
        vo.setType(p.getActionType());
        vo.setCommand(p.getActionCommand());
        return vo;
    }

    static {
        TypeStore.STORE.register(ApplicationActionDO.class, ApplicationActionVO.class, p -> {
            ApplicationActionVO vo = new ApplicationActionVO();
            vo.setId(p.getId());
            vo.setName(p.getActionName());
            vo.setType(p.getActionType());
            vo.setCommand(p.getActionCommand());
            return vo;
        });
    }
}
